<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>墨阅-后台系统</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<link th:href="@{/moyue/css/bootstrap.min.css}" rel="stylesheet"/>
	<link th:href="@{/moyue/css/face.css}"  rel="stylesheet">
	<link th:href="@{/moyue/font-awesome-4.7.0/css/font-awesome.min.css}" rel="stylesheet">
	<link rel="shortcut icon" th:href="@{/images/favicon.ico}" type="image/x-icon"/>
</head>
<body>
<div class="top">
	墨阅--后台管理
	<i class="fa fa-navicon" style="color:#f7f7f7;font-size:10px;padding-left: 50px"></i>
</div>
<div class="fixed">
	<div class="broad">
		<ul>
			<li class="broad-item">
				<a href="/moyue/admin/bms/?page=1"><span>用户管理</span><i class="fa fa-angle-left" style="position:absolute;right: 10px;top: 15px; "></i></a>
			</li>
			<li class="broad-item">
				<a th:href="@{/moyue/user/bookmanage}" ><span>书籍管理</span><i class="fa fa-angle-left" style="position:absolute;right: 10px;top: 15px; "></i></a>
			</li>
			<li class="broad-item">
				<a href="shenhe.html"><span>审核书籍</span><i class="fa fa-angle-left" style="position:absolute;right: 10px;top: 15px; "></i></a>
			</li>
			<li class="broad-item">
				<a th:href="@{/moyue/admin/parentype} "><span>管理书籍类型</span><i class="fa fa-angle-left" style="position:absolute;right: 10px;top: 15px; "></i></a>
			</li>
			<li class="broad-item">
				<a th:href="@{/moyue/admin/}"><span>管理书籍标签</span><i class="fa fa-angle-left" style="position:absolute;right: 10px;top: 15px; "></i></a>
			</li>
			<li class="broad-item">
				<a href="/moyue/word/?page=1"><span>敏感词管理</span><i class="fa fa-angle-left" style="position:absolute;right: 10px;top: 15px; "></i></a>
			</li>
			<li class="broad-item">
				<a th:href="@{/moyue/admin/book/uploadUI}"><span>书籍上传</span><i class="fa fa-angle-left" style="position:absolute;right: 10px;top: 15px; "></i></a>
			</li>
		</ul>
	</div>
	<div class="fixed-iframe">
		<div class="top-face">
        <div class="header">用户管理</div>
        <div class="table-face">
            <div class="table-mg">
                <!--<div class="mg-delete">-->
                    <!--<input type="checkbox" id="allcheck">
                    <button class="mg-delete-quan">全选</button>-->
                    <!--<input class="mg-delete-quan" type="button" value="全选" onclick="selectAll();"/>-->
    				<!--<input class="mg-delete-quan" type="button" value="全不选" onclick="SelectNO();"/>-->
                <!--</div>-->
                <!--<div class="mg-add">-->
                    <!--<button type="button" class="mg-add-button">+&nbsp;新增</button>-->
                <!--</div>-->
				<form class="mg-shou" method="post" th:action="@{/moyue/admin/user}">
					<div class="mg-shou-input">
						<input class="shou-input-in" name="userName">
						<input type="submit" class="shou-input-sh">搜索</input>
					</div>
				</form>
            </div>
            <div class="table-bet">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th class="td1"></th>
                        <th>用户昵称</th>
                        <th>用户性别</th>
                        <th>用户角色</th>
                        <th colspan="3">操作</th>
                    </tr>
                    </thead>
                    <tbody>
	                    <tr>
							<input type="hidden" th:value="${serachuser.userRewards}">
	                        <td class="td1"><input type="checkbox" th:value="${serachuser.userId}" name="user-count"></td>
	                        <td class="tds2" th:text="${serachuser.userName}"></td>
	                        <td class="tds3" th:text="${serachuser.userSex}"></td>
							<td class="tds4" th:if="${serachuser.roleId}==1">普通用户</td>
							<td class="tds4" th:if="${serachuser.roleId}==2">初级vip</td>
							<td class="tds4" th:if="${serachuser.roleId}==3">高级vip</td>
	                        <td>
	                            <a href="#" class="bet-check" onclick="aa()">查看</a>
	                        </td>
	                        <td>
	                            <a href="#" class="bet-edit">编辑</a>
	                        </td>
	                        <td>
	                            <a href="#" class="bet-delete">删除</a>
	                        </td>
	                    </tr>

                    </tbody>
				</table>
			</div>
		</div>
		</div>
	<div class="editor">
		<div><img src="img/chahao.jpg" id="chahao"/></div>
		<form action="" method="post">
			<dl>
				<dt>用户账号:</dt>
				<dd><input class="edited-1" type="" name=""value="" /></dd>
			</dl>
			<dl>
				<dt>用户性别:</dt>
				<dd><input class="edited-2" type="" name=""  value="" /></dd>
			</dl>
			<dl>
				<dt>用户虚拟币:</dt>
				<dd><input class="edited-3" type="" name=""  value="" /></dd>
			</dl>
			<dl>
				<dt>用户角色</dt>
				<dd><input class="edited-4" type="" name=""  value="" /></dd>
			</dl>
			<input type="hidden" class="edited-5">
			<input class="sub" type="button" value="确定" onclick="edited()"/>
		</form>
	</div>
	</div>
</div>
</body>
<script  th:src="@{/moyue/js/jquery-3.3.1.min.js}"></script>
<script  th:src="@{/moyue/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/moyue/js/face.js}"></script>
<script th:inline="javascript">
	$('.bet-edit').on('click',function () {
		$('.editor').fadeIn();
		$('.pass').fadeIn();
		var parent = $(this).parent().parent();
        console.log(parent);
        console.log(parent.children('td.tds2'));
        $('.edited-1').val(parent.children('td.tds2').text());
        $('.edited-2').val(parent.children('td.tds3').text());
        $('.edited-3').val(parent.children("input").val());
        $('.edited-4').val(parent.children('td.tds4').text());
        $('.edited-5').val(parent.children('td.td1').children('input').val());
    })
    $('.bet-delete').on('click',function () {
        var parent = $(this).parent().parent();
        var userids = parent.children("td.td1").children("input").val();
        $.ajax({
            type: "Delete",//数据发送的方式（post 或者 get）
            url: "/moyue/admin/user/"+ userids,//要发送的后台地址
            data: {
                userId : userids  ,
            },//要发送的数据（参数）格式为{'val1':"1","val2":"2"}
            dataType:"JSON",
            success: function (data) {//ajax请求成功后触发的方法
                if(data.code==0){
                    alert('删除成功');
                    location.reload();
                }else {

                }
            },
            error: function (msg) {//ajax请求失败后触发的方法
                alert("网络错误");//弹出错误信息
            }
        })
    })
    $('.sontype-x').click(function(){
        $('.editor').fadeOut();
        $('.bgback').addClass('none').removeClass('block');
    });
</script>
</html>